package cn.iocoder.yudao.module.crossborder.order.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 跨境电商订单状态枚举
 *
 * @author LHL
 */
@AllArgsConstructor
@Getter
public enum OrderStatusEnum {

    PENDING_CONFIRM(10, "待确认"),
    PENDING_PAYMENT(20, "待支付"),
    PAID(30, "已支付"),
    PREPARING(40, "备货中"),
    SHIPPED(50, "已发货"),
    DELIVERED(60, "已送达"),
    COMPLETED(70, "已完成"),
    CANCELLED(80, "已取消"),
    REFUNDED(90, "已退款"),
    ;

    /**
     * 状态值
     */
    private final Integer status;
    
    /**
     * 状态名称
     */
    private final String name;

    public static OrderStatusEnum getByStatus(Integer status) {
        for (OrderStatusEnum value : values()) {
            if (value.getStatus().equals(status)) {
                return value;
            }
        }
        return null;
    }

}
